<nav id="tablist" class="mui-bar mui-bar-tab">
    <a class="mui-tab-item" href="{:url('/home/index/index')}">
        <span class="mui-icon mui-icon-home"></span>
        <span class="mui-tab-label">首页</span>
    </a>
    <a class="mui-tab-item" href="{:url('/home/subject/search')}">
        <span class="mui-icon mui-icon-search"></span>
        <span class="mui-tab-label">搜索</span>
    </a>
    <a class="mui-tab-item" href="{:url('/home/business/business/index')}">
        <span class="mui-icon mui-icon-contact"></span>
        <span class="mui-tab-label">我的</span>
    </a>
</nav>
<script>
    //利用mui进行链接跳转
    mui('#tablist').on('tap', 'a', function(){
        location.href = this.href
    })

    //通过js获取的链接，来判断是哪个链接要有激活状态
    var arr = location.pathname.split('/')
    var path = arr.filter(function(value){
        return value && value.trim()
    })

    //数组的截取
    var str = path.slice(0, 2).join('/')

    if(str == "home/index")
    {
        $("#tablist a").eq(0).addClass('mui-active').siblings().removeClass('mui-active');
    }else if(str == "home/subject")
    {
        $("#tablist a").eq(1).addClass('mui-active').siblings().removeClass('mui-active');
    }
    else if(str == "home/business")
    {
        $("#tablist a").eq(2).addClass('mui-active').siblings().removeClass('mui-active');
    }
</script>